package be.gnx.fogo.application.dao;

import java.util.ArrayList;
import java.util.Enumeration;
import java.util.HashMap;
import java.util.List;
import java.util.Locale;
import java.util.Vector;

import org.hibernate.Query;
import org.hibernate.Transaction;

import be.gnx.fogo.application.model.Label;
import be.gnx.fogo.application.util.HibernateUtil;

public class LabelDao extends ObjectDao<Label, Long> {

  public LabelDao() {
    super(Label.class, "id");
  }

  public Enumeration<String> getLabels() {
    List<String> labels = null;
    Transaction transaction = HibernateUtil.getTransaction();
    if (!transaction.isActive()) {
      transaction.begin();
      try {
        labels = getLabelsWithoutTransaction();
      } finally {
        transaction.commit();
      }
    } else {
      labels = getLabelsWithoutTransaction();
    }
    Vector<String> vector = new Vector<String>();
    vector.addAll(labels);
    return vector.elements();
  }

  private List<String> getLabelsWithoutTransaction() {
    String hql = new String("select distinct label.label from Label as label order by label.label");
    Query query = HibernateUtil.createQuery(hql);
    return query.list();
  }

  public Object handleGetObject(String label, Locale locale) {
    String translation = null;
    Transaction transaction = HibernateUtil.getTransaction();
    if (!transaction.isActive()) {
      transaction.begin();
      try {
        translation = handleGetObjectWithoutTransaction(label, locale);
      } finally {
        transaction.commit();
      }
    } else {
      translation = handleGetObjectWithoutTransaction(label, locale);
    }
    return translation;
  }

  public String handleGetObjectWithoutTransaction(String label, Locale locale) {
    StringBuffer hql = new StringBuffer("from Label as label where label.label = '" + label + "'");
    if (locale.getLanguage().length() > 0) {
      hql.append(" AND (label.language = '" + locale.getLanguage() + "' OR label.language is null)");
    } else {
      hql.append(" AND label.language is null");
    }
    if (locale.getCountry().length() > 0) {
      hql.append(" AND (label.country = '" + locale.getCountry() + "' OR label.country is null)");
    } else {
      hql.append(" AND label.country is null");
    }
    if ((locale.getVariant() != null) && (locale.getVariant().length() > 0)) {
      hql.append(" AND (label.variant = '" + locale.getVariant() + "' OR label.variant is null)");
    } else {
      hql.append(" AND label.variant is null");
    }
    hql.append(" order by label.language desc, label.country desc, label.variant desc");
    Query query = HibernateUtil.createQuery(hql.toString());
    List<Label> translations = query.list();
    if ((translations != null) && (translations.size() > 0)) {
      return translations.get(0).getTranslation();
    } else {
      return null;
    }
  }

  public void initialise() {
    List<Label> list = getAll();
    HashMap<String, Label> labelsHashMap = new HashMap<String, Label>();
    for (Label label : list) {
      labelsHashMap.put(label.getLabel(), label);
    }

    final List<Label> initialLabels = new ArrayList<Label>(); {
      initialLabels.add(createLabel("ad__andorra__country" ,"Andorra"));
      initialLabels.add(createLabel("ae__united_arab_emirates__country" ,"United Arab Emirates"));
      initialLabels.add(createLabel("af__afghanistan__country" ,"Afghanistan"));
      initialLabels.add(createLabel("ag__antigua_and_barbuda__country" ,"Antigua and Barbuda"));
      initialLabels.add(createLabel("ai__anguilla__country" ,"Anguilla"));
      initialLabels.add(createLabel("al__albania__country" ,"Albania"));
      initialLabels.add(createLabel("am__armenia__country" ,"Armenia"));
      initialLabels.add(createLabel("an__netherlands_antilles__country" ,"Netherlands Antilles"));
      initialLabels.add(createLabel("ao__angola__country" ,"Angola"));
      initialLabels.add(createLabel("aq__antarctica__country" ,"Antarctica"));
      initialLabels.add(createLabel("ar__argentina__country" ,"Argentina"));
      initialLabels.add(createLabel("as__american_samoa__country" ,"American Samoa"));
      initialLabels.add(createLabel("at__austria__country" ,"Austria"));
      initialLabels.add(createLabel("au__australia__country" ,"Australia"));
      initialLabels.add(createLabel("aw__aruba__country" ,"Aruba"));
      initialLabels.add(createLabel("ax__aland_islands__country" ,"Åland Islands"));
      initialLabels.add(createLabel("az__azerbaijan__country" ,"Azerbaijan"));
      initialLabels.add(createLabel("ba__bosnia_and_herzegovina__country" ,"Bosnia and Herzegovina"));
      initialLabels.add(createLabel("bb__barbados__country" ,"Barbados"));
      initialLabels.add(createLabel("bd__bangladesh__country" ,"Bangladesh"));
      initialLabels.add(createLabel("be__belgium__country" ,"Belgium"));
      initialLabels.add(createLabel("bf__burkina_faso__country" ,"Burkina Faso"));
      initialLabels.add(createLabel("bg__bulgaria__country" ,"Bulgaria"));
      initialLabels.add(createLabel("bh__bahrain__country" ,"Bahrain"));
      initialLabels.add(createLabel("bi__burundi__country" ,"Burundi"));
      initialLabels.add(createLabel("bj__benin__country" ,"Benin"));
      initialLabels.add(createLabel("bl__saint_barthelemy__country" ,"Saint Barthélemy"));
      initialLabels.add(createLabel("bm__bermuda__country" ,"Bermuda"));
      initialLabels.add(createLabel("bn__brunei_darussalam__country" ,"Brunei Darussalam"));
      initialLabels.add(createLabel("bo__bolivia__country" ,"Bolivia"));
      initialLabels.add(createLabel("br__brazil__country" ,"Brazil"));
      initialLabels.add(createLabel("bs__bahamas__country" ,"Bahamas"));
      initialLabels.add(createLabel("bt__bhutan__country" ,"Bhutan"));
      initialLabels.add(createLabel("bv__bouvet_island__country" ,"Bouvet Island"));
      initialLabels.add(createLabel("bw__botswana__country" ,"Botswana"));
      initialLabels.add(createLabel("by__belarus__country" ,"Belarus"));
      initialLabels.add(createLabel("bz__belize__country" ,"Belize"));
      initialLabels.add(createLabel("ca__canada__country" ,"Canada"));
      initialLabels.add(createLabel("cc__cocos_keeling_islands__country" ,"Cocos (Keeling) Islands"));
      initialLabels.add(createLabel("cd__congo_the_democratic_republic_of_the__country" ,"Congo, the Democratic Republic of the"));
      initialLabels.add(createLabel("cf__central_african_republic__country" ,"Central African Republic"));
      initialLabels.add(createLabel("cg__congo__country" ,"Congo"));
      initialLabels.add(createLabel("ch__switzerland__country" ,"Switzerland"));
      initialLabels.add(createLabel("ci__cote_d_ivoire__country" ,"Côte d'Ivoire"));
      initialLabels.add(createLabel("ck__cook_islands__country" ,"Cook Islands"));
      initialLabels.add(createLabel("cl__chile__country" ,"Chile"));
      initialLabels.add(createLabel("cm__cameroon__country" ,"Cameroon"));
      initialLabels.add(createLabel("cn__china__country" ,"China"));
      initialLabels.add(createLabel("co__colombia__country" ,"Colombia"));
      initialLabels.add(createLabel("cr__costa_rica__country" ,"Costa Rica"));
      initialLabels.add(createLabel("cu__cuba__country" ,"Cuba"));
      initialLabels.add(createLabel("cv__cape_verde__country" ,"Cape Verde"));
      initialLabels.add(createLabel("cx__christmas_island__country" ,"Christmas Island"));
      initialLabels.add(createLabel("cy__cyprus__country" ,"Cyprus"));
      initialLabels.add(createLabel("cz__czech_republic__country" ,"Czech Republic"));
      initialLabels.add(createLabel("de__germany__country" ,"Germany"));
      initialLabels.add(createLabel("dj__djibouti__country" ,"Djibouti"));
      initialLabels.add(createLabel("dk__denmark__country" ,"Denmark"));
      initialLabels.add(createLabel("dm__dominica__country" ,"Dominica"));
      initialLabels.add(createLabel("do__dominican_republic__country" ,"Dominican Republic"));
      initialLabels.add(createLabel("dz__algeria__country" ,"Algeria"));
      initialLabels.add(createLabel("ec__ecuador__country" ,"Ecuador"));
      initialLabels.add(createLabel("ee__estonia__country" ,"Estonia"));
      initialLabels.add(createLabel("eg__egypt__country" ,"Egypt"));
      initialLabels.add(createLabel("eh__western_sahara__country" ,"Western Sahara"));
      initialLabels.add(createLabel("er__eritrea__country" ,"Eritrea"));
      initialLabels.add(createLabel("es__spain__country" ,"Spain"));
      initialLabels.add(createLabel("et__ethiopia__country" ,"Ethiopia"));
      initialLabels.add(createLabel("fi__finland__country" ,"Finland"));
      initialLabels.add(createLabel("fj__fiji__country" ,"Fiji"));
      initialLabels.add(createLabel("fk__falkland_islands_malvinas__country" ,"Falkland Islands (Malvinas)"));
      initialLabels.add(createLabel("fm__micronesia_federated_states_of__country" ,"Micronesia, Federated States of"));
      initialLabels.add(createLabel("fo__faroe_islands__country" ,"Faroe Islands"));
      initialLabels.add(createLabel("fr__france__country" ,"France"));
      initialLabels.add(createLabel("ga__gabon__country" ,"Gabon"));
      initialLabels.add(createLabel("gb__united_kingdom__country" ,"United Kingdom"));
      initialLabels.add(createLabel("gd__grenada__country" ,"Grenada"));
      initialLabels.add(createLabel("ge__georgia__country" ,"Georgia"));
      initialLabels.add(createLabel("gf__french_guiana__country" ,"French Guiana"));
      initialLabels.add(createLabel("gg__guernsey__country" ,"Guernsey"));
      initialLabels.add(createLabel("gh__ghana__country" ,"Ghana"));
      initialLabels.add(createLabel("gi__gibraltar__country" ,"Gibraltar"));
      initialLabels.add(createLabel("gl__greenland__country" ,"Greenland"));
      initialLabels.add(createLabel("gm__gambia__country" ,"Gambia"));
      initialLabels.add(createLabel("gn__guinea__country" ,"Guinea"));
      initialLabels.add(createLabel("gp__guadeloupe__country" ,"Guadeloupe"));
      initialLabels.add(createLabel("gq__equatorial_guinea__country" ,"Equatorial Guinea"));
      initialLabels.add(createLabel("gr__greece__country" ,"Greece"));
      initialLabels.add(createLabel("gs__south_georgia_and_the_south_sandwich_islands__country" ,"South Georgia and the South Sandwich Islands"));
      initialLabels.add(createLabel("gt__guatemala__country" ,"Guatemala"));
      initialLabels.add(createLabel("gu__guam__country" ,"Guam"));
      initialLabels.add(createLabel("gw__guinea-bissau__country" ,"Guinea-Bissau"));
      initialLabels.add(createLabel("gy__guyana__country" ,"Guyana"));
      initialLabels.add(createLabel("hk__hong_kong__country" ,"Hong Kong"));
      initialLabels.add(createLabel("hm__heard_island_and_mcdonald_islands__country" ,"Heard Island and McDonald Islands"));
      initialLabels.add(createLabel("hn__honduras__country" ,"Honduras"));
      initialLabels.add(createLabel("hr__croatia__country" ,"Croatia"));
      initialLabels.add(createLabel("ht__haiti__country" ,"Haiti"));
      initialLabels.add(createLabel("hu__hungary__country" ,"Hungary"));
      initialLabels.add(createLabel("id__indonesia__country" ,"Indonesia"));
      initialLabels.add(createLabel("ie__ireland__country" ,"Ireland"));
      initialLabels.add(createLabel("il__israel__country" ,"Israel"));
      initialLabels.add(createLabel("im__isle_of_man__country" ,"Isle of Man"));
      initialLabels.add(createLabel("in__india__country" ,"India"));
      initialLabels.add(createLabel("io__british_indian_ocean_territory__country" ,"British Indian Ocean Territory"));
      initialLabels.add(createLabel("iq__iraq__country" ,"Iraq"));
      initialLabels.add(createLabel("ir__iran_islamic_republic_of__country" ,"Iran, Islamic Republic of"));
      initialLabels.add(createLabel("is__iceland__country" ,"Iceland"));
      initialLabels.add(createLabel("it__italy__country" ,"Italy"));
      initialLabels.add(createLabel("je__jersey__country" ,"Jersey"));
      initialLabels.add(createLabel("jm__jamaica__country" ,"Jamaica"));
      initialLabels.add(createLabel("jo__jordan__country" ,"Jordan"));
      initialLabels.add(createLabel("jp__japan__country" ,"Japan"));
      initialLabels.add(createLabel("ke__kenya__country" ,"Kenya"));
      initialLabels.add(createLabel("kg__kyrgyzstan__country" ,"Kyrgyzstan"));
      initialLabels.add(createLabel("kh__cambodia__country" ,"Cambodia"));
      initialLabels.add(createLabel("ki__kiribati__country" ,"Kiribati"));
      initialLabels.add(createLabel("km__comoros__country" ,"Comoros"));
      initialLabels.add(createLabel("kn__saint_kitts_and_nevis__country" ,"Saint Kitts and Nevis"));
      initialLabels.add(createLabel("kp__korea_democratic_people_s_republic_of__country" ,"Korea, Democratic People's Republic of"));
      initialLabels.add(createLabel("kr__korea_republic_of__country" ,"Korea, Republic of"));
      initialLabels.add(createLabel("kw__kuwait__country" ,"Kuwait"));
      initialLabels.add(createLabel("ky__cayman_islands__country" ,"Cayman Islands"));
      initialLabels.add(createLabel("kz__kazakhstan__country" ,"Kazakhstan"));
      initialLabels.add(createLabel("la__lao_people_s_democratic_republic__country" ,"Lao People's Democratic Republic"));
      initialLabels.add(createLabel("lb__lebanon__country" ,"Lebanon"));
      initialLabels.add(createLabel("lc__saint_lucia__country" ,"Saint Lucia"));
      initialLabels.add(createLabel("li__liechtenstein__country" ,"Liechtenstein"));
      initialLabels.add(createLabel("lk__sri_lanka__country" ,"Sri Lanka"));
      initialLabels.add(createLabel("lr__liberia__country" ,"Liberia"));
      initialLabels.add(createLabel("ls__lesotho__country" ,"Lesotho"));
      initialLabels.add(createLabel("lt__lithuania__country" ,"Lithuania"));
      initialLabels.add(createLabel("lu__luxembourg__country" ,"Luxembourg"));
      initialLabels.add(createLabel("lv__latvia__country" ,"Latvia"));
      initialLabels.add(createLabel("ly__libyan_arab_jamahiriya__country" ,"Libyan Arab Jamahiriya"));
      initialLabels.add(createLabel("ma__morocco__country" ,"Morocco"));
      initialLabels.add(createLabel("mc__monaco__country" ,"Monaco"));
      initialLabels.add(createLabel("md__moldova,_republic_of__country" ,"Moldova, Republic of"));
      initialLabels.add(createLabel("me__montenegro__country" ,"Montenegro"));
      initialLabels.add(createLabel("mf__saint_martin_french_part__country" ,"Saint Martin (French part)"));
      initialLabels.add(createLabel("mg__madagascar__country" ,"Madagascar"));
      initialLabels.add(createLabel("mh__marshall_islands__country" ,"Marshall Islands"));
      initialLabels.add(createLabel("mk__macedonia,_the_former_yugoslav_republic_of__country" ,"Macedonia, the former Yugoslav Republic of"));
      initialLabels.add(createLabel("ml__mali__country" ,"Mali"));
      initialLabels.add(createLabel("mm__myanmar__country" ,"Myanmar"));
      initialLabels.add(createLabel("mn__mongolia__country" ,"Mongolia"));
      initialLabels.add(createLabel("mo__macao__country" ,"Macao"));
      initialLabels.add(createLabel("mp__northern_mariana_islands__country" ,"Northern Mariana Islands"));
      initialLabels.add(createLabel("mq__martinique__country" ,"Martinique"));
      initialLabels.add(createLabel("mr__mauritania__country" ,"Mauritania"));
      initialLabels.add(createLabel("ms__montserrat__country" ,"Montserrat"));
      initialLabels.add(createLabel("mt__malta__country" ,"Malta"));
      initialLabels.add(createLabel("mu__mauritius__country" ,"Mauritius"));
      initialLabels.add(createLabel("mv__maldives__country" ,"Maldives"));
      initialLabels.add(createLabel("mw__malawi__country" ,"Malawi"));
      initialLabels.add(createLabel("mx__mexico__country" ,"Mexico"));
      initialLabels.add(createLabel("my__malaysia__country" ,"Malaysia"));
      initialLabels.add(createLabel("mz__mozambique__country" ,"Mozambique"));
      initialLabels.add(createLabel("na__namibia__country" ,"Namibia"));
      initialLabels.add(createLabel("nc__new_caledonia__country" ,"New Caledonia"));
      initialLabels.add(createLabel("ne__niger__country" ,"Niger"));
      initialLabels.add(createLabel("nf__norfolk_island__country" ,"Norfolk Island"));
      initialLabels.add(createLabel("ng__nigeria__country" ,"Nigeria"));
      initialLabels.add(createLabel("ni__nicaragua__country" ,"Nicaragua"));
      initialLabels.add(createLabel("nl__netherlands__country" ,"Netherlands"));
      initialLabels.add(createLabel("no__norway__country" ,"Norway"));
      initialLabels.add(createLabel("np__nepal__country" ,"Nepal"));
      initialLabels.add(createLabel("nr__nauru__country" ,"Nauru"));
      initialLabels.add(createLabel("nu__niue__country" ,"Niue"));
      initialLabels.add(createLabel("nz__new_zealand__country" ,"New Zealand"));
      initialLabels.add(createLabel("om__oman__country" ,"Oman"));
      initialLabels.add(createLabel("pa__panama__country" ,"Panama"));
      initialLabels.add(createLabel("pe__peru__country" ,"Peru"));
      initialLabels.add(createLabel("pf__french_polynesia__country" ,"French Polynesia"));
      initialLabels.add(createLabel("pg__papua_new_guinea__country" ,"Papua New Guinea"));
      initialLabels.add(createLabel("ph__philippines__country" ,"Philippines"));
      initialLabels.add(createLabel("pk__pakistan__country" ,"Pakistan"));
      initialLabels.add(createLabel("pl__poland__country" ,"Poland"));
      initialLabels.add(createLabel("pm__saint_pierre_and_miquelon__country" ,"Saint Pierre and Miquelon"));
      initialLabels.add(createLabel("pn__pitcairn__country" ,"Pitcairn"));
      initialLabels.add(createLabel("pr__puerto_rico__country" ,"Puerto Rico"));
      initialLabels.add(createLabel("ps__palestinian_territory,_occupied__country" ,"Palestinian Territory, Occupied"));
      initialLabels.add(createLabel("pt__portugal__country" ,"Portugal"));
      initialLabels.add(createLabel("pw__palau__country" ,"Palau"));
      initialLabels.add(createLabel("py__paraguay__country" ,"Paraguay"));
      initialLabels.add(createLabel("qa__qatar__country" ,"Qatar"));
      initialLabels.add(createLabel("re__reunion__country" ,"Réunion"));
      initialLabels.add(createLabel("ro__romania__country" ,"Romania"));
      initialLabels.add(createLabel("rs__serbia__country" ,"Serbia"));
      initialLabels.add(createLabel("ru__russian_federation__country" ,"Russian Federation"));
      initialLabels.add(createLabel("rw__rwanda__country" ,"Rwanda"));
      initialLabels.add(createLabel("sa__saudi_arabia__country" ,"Saudi Arabia"));
      initialLabels.add(createLabel("sb__solomon_islands__country" ,"Solomon Islands"));
      initialLabels.add(createLabel("sc__seychelles__country" ,"Seychelles"));
      initialLabels.add(createLabel("sd__sudan__country" ,"Sudan"));
      initialLabels.add(createLabel("se__sweden__country" ,"Sweden"));
      initialLabels.add(createLabel("sg__singapore__country" ,"Singapore"));
      initialLabels.add(createLabel("sh__saint_helena__country" ,"Saint Helena"));
      initialLabels.add(createLabel("si__slovenia__country" ,"Slovenia"));
      initialLabels.add(createLabel("sj__svalbard_and_jan_mayen__country" ,"Svalbard and Jan Mayen"));
      initialLabels.add(createLabel("sk__slovakia__country" ,"Slovakia"));
      initialLabels.add(createLabel("sl__sierra_leone__country" ,"Sierra Leone"));
      initialLabels.add(createLabel("sm__san_marino__country" ,"San Marino"));
      initialLabels.add(createLabel("sn__senegal__country" ,"Senegal"));
      initialLabels.add(createLabel("so__somalia__country" ,"Somalia"));
      initialLabels.add(createLabel("sr__suriname__country" ,"Suriname"));
      initialLabels.add(createLabel("st__sao_tome_and_principe__country" ,"Sao Tome and Principe"));
      initialLabels.add(createLabel("sv__el_salvador__country" ,"El Salvador"));
      initialLabels.add(createLabel("sy__syrian_arab_republic__country" ,"Syrian Arab Republic"));
      initialLabels.add(createLabel("sz__swaziland__country" ,"Swaziland"));
      initialLabels.add(createLabel("tc__turks_and_caicos_islands__country" ,"Turks and Caicos Islands"));
      initialLabels.add(createLabel("td__chad__country" ,"Chad"));
      initialLabels.add(createLabel("tf__french_southern_territories__country" ,"French Southern Territories"));
      initialLabels.add(createLabel("tg__togo__country" ,"Togo"));
      initialLabels.add(createLabel("th__thailand__country" ,"Thailand"));
      initialLabels.add(createLabel("tj__tajikistan__country" ,"Tajikistan"));
      initialLabels.add(createLabel("tk__tokelau__country" ,"Tokelau"));
      initialLabels.add(createLabel("tl__timor_leste__country" ,"Timor-Leste"));
      initialLabels.add(createLabel("tm__turkmenistan__country" ,"Turkmenistan"));
      initialLabels.add(createLabel("tn__tunisia__country" ,"Tunisia"));
      initialLabels.add(createLabel("to__tonga__country" ,"Tonga"));
      initialLabels.add(createLabel("tr__turkey__country" ,"Turkey"));
      initialLabels.add(createLabel("tt__trinidad_and_tobago__country" ,"Trinidad and Tobago"));
      initialLabels.add(createLabel("tv__tuvalu__country" ,"Tuvalu"));
      initialLabels.add(createLabel("tw__taiwan_province_of_china__country" ,"Taiwan, Province of China"));
      initialLabels.add(createLabel("tz__tanzania_united_republic_of__country" ,"Tanzania, United Republic of"));
      initialLabels.add(createLabel("ua__ukraine__country" ,"Ukraine"));
      initialLabels.add(createLabel("ug__uganda__country" ,"Uganda"));
      initialLabels.add(createLabel("um__united_states_minor_outlying_islands__country" ,"United States Minor Outlying Islands"));
      initialLabels.add(createLabel("us__united_states__country" ,"United States"));
      initialLabels.add(createLabel("uy__uruguay__country" ,"Uruguay"));
      initialLabels.add(createLabel("uz__uzbekistan__country" ,"Uzbekistan"));
      initialLabels.add(createLabel("va__holy_see_vatican_city_state__country" ,"Holy See (Vatican City State)"));
      initialLabels.add(createLabel("vc__saint_vincent_and_the_grenadines__country" ,"Saint Vincent and the Grenadines"));
      initialLabels.add(createLabel("ve__venezuela__country" ,"Venezuela"));
      initialLabels.add(createLabel("vg__virgin_islands_british__country" ,"Virgin Islands, British"));
      initialLabels.add(createLabel("vi__virgin_islands_u_s__country" ,"Virgin Islands, U.S."));
      initialLabels.add(createLabel("vn__viet_nam__country" ,"Viet Nam"));
      initialLabels.add(createLabel("vu__vanuatu__country" ,"Vanuatu"));
      initialLabels.add(createLabel("wf__wallis_and_futuna__country" ,"Wallis and Futuna"));
      initialLabels.add(createLabel("ws__samoa__country" ,"Samoa"));
      initialLabels.add(createLabel("ye__yemen__country" ,"Yemen"));
      initialLabels.add(createLabel("yt__mayotte__country" ,"Mayotte"));
      initialLabels.add(createLabel("za__south_africa__country" ,"South Africa"));
      initialLabels.add(createLabel("zm__zambia__country" ,"Zambia"));
      initialLabels.add(createLabel("zw__zimbabwe__country" ,"Zimbabwe"));
      initialLabels.add(createLabel("zz__unkown__country" ,"Unkown"));
      }
    for (Label label : initialLabels) {
      if (!labelsHashMap.containsKey(label.getLabel())) {
        save(label);
      }
    }
  }

  private static Label createLabel(String labelString, String translation) {
    Label label = new Label();
    label.setLabel(labelString);
    label.setTranslation(translation);
    return label;
  }

}
